package com.lft14.threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Function: 		A {@code TestThreadPool} object With Some FUNCTION.<br/>
 * Reason:   		ADD REASON.<br/>
 * Date:            2021-01-28 17:11<br/>
 * <p>
 * Class Name:      TestThreadPool<br/>
 * Package Name:    com.lft14.threadpool<br/>
 * @author Laifengting / E-mail:laifengting@foxmail.com
 * @version 1.0.0
 * @since JDK 8
 */
public class TestThreadPool {
	public static void main(String[] args) {
		// 1. 创建服务，创建线程池
		ExecutorService service = Executors.newFixedThreadPool(10);
		// 2. 执行线程
		service.execute(new MyThread());
		service.execute(new MyThread());
		service.execute(new MyThread());
		service.execute(new MyThread());
		service.execute(new MyThread());
		
		// 3. 关闭线程池
		service.shutdown();
	}
}

class MyThread implements Runnable {
	@Override
	public void run() {
		System.out.println(Thread.currentThread().getName());
	}
}










